package gc.analyze;

import org.junit.Assert;
import org.junit.Test;

public class Smooth_utest {

	@Test
	public void test1_w5() {
		long[] input = { 10 };
		long[] expected = {
				0, 0,
				5, 0,
				10, 0,
				15, 0
		};
		long[] actual = Smooth.smooth(input, 5);
		Assert.assertArrayEquals(expected, actual);
	}

	@Test
	public void test1_w15() {
		long[] input = { 10 };
		long[] expected = {
				0, 0,
				10, 0,
				15, 0,
				25, 0
		};
		long[] actual = Smooth.smooth(input, 15);
		Assert.assertArrayEquals(expected, actual);
	}

	@Test
	public void test3_w5() {
		long[] input = { 10, 10, 10 };
		long[] expected = {
				0, 0,
				5, 0,
				10, 0,
				15, 5,
				20, 5,
				25, 0,
				30, 0,
				35, 0,
		};
		long[] actual = Smooth.smooth(input, 5);
		Assert.assertArrayEquals(expected, actual);
	}

	@Test
	public void test3_w10() {
		long[] input = { 10, 10, 10 };
		long[] expected = {
				0, 0,
				10, 0,
				10, 0,
				20, 10,
				20, 10,
				30, 0,
				30, 0,
				40, 0,
		};
		long[] actual = Smooth.smooth(input, 10);
		Assert.assertArrayEquals(expected, actual);
	}

	@Test
	public void test3_w15() {
		long[] input = { 10, 10, 10 };
		long[] expected = {
				0, 0,
				10, 0,
				15, 5,
				20, 10,
				25, 10,
				30, 5,
				35, 0,
				45, 0,
		};
		long[] actual = Smooth.smooth(input, 15);
		Assert.assertArrayEquals(expected, actual);
	}

	@Test
	public void test3W_w15() {
		long[] input = { 10, 20, 10 };
		long[] expected = {
				0, 0,
				10, 0,
				15, 5,
				25, 15,
				30, 15,
				40, 5,
				45, 0,
				55, 0,
		};
		long[] actual = Smooth.smooth(input, 15);
		Assert.assertArrayEquals(expected, actual);
	}

	@Test
	public void test5_w15() {
		long[] input = { 10, 5, 10, 20, 10 };
		long[] expected = {
				0, 0,
				10, 0,
				15, 5,
				15, 5,
				25, 5,
				25, 5,
				30, 5,
				40, 15,
				45, 15,
				55, 5,
				60, 0,
				70, 0,
		};
		long[] actual = Smooth.smooth(input, 15);
		Assert.assertArrayEquals(expected, actual);
	}

	@Test
	public void testAllocWindow() {
		long[] l1 = new long[(int) 1e7];
		long[] l2 = new long[(int) 2e7];
		long[] l4 = new long[(int) 4e7];
	}
}
